#include "findscudialog.h"
#include "ui_findscudialog.h"

#include "../DicomService/findscuthread.h"
#include "importstudymodel.h"
#include "importstudyview.h"

FindScuDialog::FindScuDialog(QWidget *parent) :
    studyModel(new ImportStudyModel(this)),
    studyView(new ImportStudyView(this)),
    QDialog(parent),
    ui(new Ui::FindScuDialog)
{
    ui->setupUi(this);

    studyView->setModel(studyModel);
    studyView->setColumnHidden(ImportStudyModel::Reports, true);
    studyView->setColumnHidden(ImportStudyModel::StudyStatus, true);
    ui->verticalLayout->insertWidget(0, studyView);

    findThread = new FindSCUThread(studyModel, this);

    connect(studyView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
}

FindScuDialog::~FindScuDialog()
{
    delete ui;
}

QStringList FindScuDialog::getSelectedStudyUids() const
{
    return studyModel->getSelectedStudyUids(studyView->getSelectedIndexes());
}
